package com.company;

public class L_Student {
    public String name; // 公共属性
    final int sex = 0; // 最终属性
    private int age; //私有属性
    private boolean b;

    public boolean isSex() {
        return b;
    }

    public void setSex(boolean b) {
        this.b = b;
    }

    public StringBuffer printInfo(L_Student st) {
        StringBuffer sb = new StringBuffer();
        sb.append("学生姓名："+st.name+"\n 学生年龄："+st.age+"\n 学生性别："+st.isSex());
        return sb;
    }

    public static void main(String[] args) {
        L_Student zhang = new L_Student(); //创建一个实例
        zhang.name = "张子桐";
        String isMan = zhang.isSex() ? "女" : "男";
        System.out.println("姓名：" + zhang.name + " 性别：" + isMan + " 年龄：" + zhang.name);
        L_Student li = new L_Student();
        li.name = "李子文";
        li.age = 15;
        li.b = true;
        String isWoman = li.isSex() ? "女" : "男";
        System.out.println("姓名：" + li.name + " 性别: " + isWoman + " 年龄: " + li.age);
    }

}
